package com.hxd.otc.module.order.presenter;

import android.support.annotation.NonNull;

import com.hxd.otc.base.BaseBean;
import com.hxd.otc.module.order.bean.RedPointBean;
import com.hxd.otc.module.order.contract.OrderContract;
import com.hxd.otc.module.order.model.AllOrderModel;
import com.hxd.otc.mvp.base.BasePresenter;
import com.hxd.otc.net.BaseObserver;

/**
 * 作  者 :  zjl
 * 时  间 :  2018/6/26 14:14
 */
public class OrderPresenter extends BasePresenter<OrderContract.View> implements OrderContract.Presenter {
    private AllOrderModel allOrderModel;


    public OrderPresenter(OrderContract.View view) {
        super(view);
        allOrderModel = AllOrderModel.getInstance();
    }

    @Override
    public void start() {

    }

    @Override
    public void redPointFlag() {
        allOrderModel.redPointFlag(new BaseObserver<RedPointBean>() {
            @Override
            public void onNext(@NonNull String msg, @NonNull RedPointBean bean) {
                mView.getPointFlag(bean);
            }

            @Override
            public void onError(int errType, @NonNull String errMessage) {
                mView.showToast(errMessage);
            }

        }, mView.<BaseBean<RedPointBean>>bindAutoDispose());
    }
}
